<template>
  <Empty>
    <slot name="search"></slot>
    <div
      style="
        display: flex;
        justify-content: flex-end;
        align-items: center;
        column-gap: 20px;
      "
    >
      <el-upload
        v-if="isUpload"
        action=""
        :http-request="upload"
        :multiple="false"
        :show-file-list="false"
      >
        <el-button type="info">上传</el-button>
      </el-upload>
      <el-button type="success" @click="create">{{ buttonText }}</el-button>
    </div>
    <div style="flex: 1; min-height: 0; margin: 20px 0px">
      <div style="height: 100%">
        <slot name="table"></slot>
      </div>
    </div>
    <div style="display: flex; justify-content: center; align-items: center">
      <slot name="pagination"></slot>
    </div>
  </Empty>
</template>

<script>
import Empty from "@/views/component/empty/index.vue";
export default {
  name: "Main",
  props: {
    isUpload: {
      type: Boolean,
    },
    buttonText: {
      type: String,
      default: "创建",
    },
  },
  components: {
    Empty,
  },
  methods: {
    create() {
      this.$emit("create");
    },
    upload(event) {
      this.$emit("upload", event);
    },
  },
};
</script>
